package com.atguigu.springbootmybatisplusrabbitmq.controller;

import com.atguigu.springbootmybatisplusrabbitmq.entity.User;
import com.atguigu.springbootmybatisplusrabbitmq.service.UserService;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController

@RequestMapping("/user")
@CrossOrigin
public class UserController {
    @Resource
    private UserService userService;
    @RequestMapping(value = "/list",method = RequestMethod.GET )
    public List<User> userList(){
        List<User> users = userService.list();
        users.forEach(System.out::println);
        return users;
    }
}
